package com.shenzhen.horselive.adapter;

import android.opengl.Visibility;
import android.view.Gravity;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.shenzhen.horselive.R;
import com.shenzhen.horselive.beans.LimitRange;

import org.jetbrains.annotations.NotNull;

public class MapLimitTabAdapter extends BaseQuickAdapter<LimitRange.DataBean, BaseViewHolder> {
    private  int selection;
    public MapLimitTabAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, LimitRange.DataBean s) {
            if (baseViewHolder.getAdapterPosition()==selection)
            {
                baseViewHolder.setBackgroundResource(R.id.tv_name,R.drawable.shape_limt_addr_tab_selected);
                baseViewHolder.setTextColorRes(R.id.tv_name,R.color.white);
            }
            else
            {
                baseViewHolder.setBackgroundResource(R.id.tv_name,R.drawable.shape_item_limti);
                baseViewHolder.setTextColorRes(R.id.tv_name,R.color.color_9);
            }
            baseViewHolder.setText(R.id.tv_name,s.getRangeDesc());
            if (s.getIsUsed()==1)
            {
                baseViewHolder.setVisible(R.id.ico_lock, false);
            }
            else
            {
                baseViewHolder.setVisible(R.id.ico_lock, true);
            }


    }

    public  void  setPosition(int  selection)
    {
        this.selection =selection;
        notifyDataSetChanged();
    }

    public int getSelection() {
        return selection;
    }
}
